package com.woniuxy.boot.common.bean;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

@Data
@Document(indexName = "esmassage")
public class EsMessage implements Serializable {
    @Id
    private Long id;
    /**
     * 内容
     */
    @Field(type = FieldType.Long , value = "contentId")
    private Long contentId;//内容（可能视频，处理有待思考）
    /**
     * 是否推荐
     */
    @Field(type = FieldType.Text , value = "recommend")
    private String recommend;//是否推荐
    /**
     * 提交时间
     */
    @Field(type = FieldType.Date , value = "commitTime",format = {},pattern = "yyyy-MM-dd HH:mm:ss || yyyy-MM-dd'T'HH:mm:ss'+08:00' || strict_date_optional_time || epoch_millis")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime commitTime;//提交时间
    /**
     * 标题
     */
    @Field(type = FieldType.Text , value = "title")
    private String title;//标题
    /**
     * 编号
     */
    @Field(type = FieldType.Text , value = "no")
    private String no;//编号
    /**
     * 最近修改时间
     */
    @Field(type = FieldType.Date , value = "lastChangetime",format = {},pattern = "yyyy-MM-dd HH:mm:ss || yyyy-MM-dd'T'HH:mm:ss'+08:00' || strict_date_optional_time || epoch_millis")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime lastChangetime;//最近修改时间
    /**
     * 文章类别id
     */
    @Field(type = FieldType.Long , value = "articleCategoryId")
    private Long articleCategoryId;//文章类别id

    /**
     * 下架时间
     */
    @Field(type = FieldType.Date , value = "downTime",format = {},pattern = "yyyy-MM-dd HH:mm:ss || yyyy-MM-dd'T'HH:mm:ss'+08:00' || strict_date_optional_time || epoch_millis")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime downTime;//下架时间

    /**
     * 媒体
     */
    @Field(type = FieldType.Nested , value = "mediaList")
    private List<Media> mediaList;
}
